﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/App.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<ResourceDescription>>" %>

<%@ Import Namespace="Ornament.MemberShip.Permissions" %>
<%@ Import Namespace="Ornament.Web" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    选择资源类型
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%
        var permission = (Permission)Session["permission"];
        var routeValue = new
        {
            id = permission.Id == Guid.Empty
            ? ""
            : permission.Id.ToString()
        };
    %>
    <form method="post" action="<%=Url.Action("SelectResource", routeValue)%>">
    <%
       
        var i = 0;
        var rd = (ResourceDescription)ViewData["selectedResourceType"];

        foreach (var resourceSetting in this.Model)
        {
            var check = (rd != null && rd.Path == resourceSetting.Path) ? "checked='checked'" : "";
    %>
    <div>
        <input id="pathOfResourceType<%=i%>" name="pathOfResourceType" <%=check %> value="<%=resourceSetting.Path%>"
            type="radio" />
        <label for="pathOfResourceType<%=i%>">
            <%=resourceSetting.Name %></label>
    </div>
    <%
        i++;
        }
    %>
    <div>
        <button type="submit">
            下一步</button>
        <button type="button" id="cancel">
            取消</button>
    </div>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">

    <script type="text/javascript">
        $(document).ready(function() {
            $('#cancel').click(function() {
                if (confirm("选择离开会失去当前数据.点击'确认'退出")) {
                    location = '<%=Url.Action("index")%>';
                }
            });
        });
    </script>

</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PageTitle" runat="server">
    选择资源类型
</asp:Content>
